package com.moneytalks.blazepoc.services {
	import com.moneytalks.blazepoc.dto.NoteDto;
	
	import mx.rpc.AsyncToken;
	import mx.rpc.IResponder;
	import mx.rpc.remoting.RemoteObject;
	
	public class NotebookServiceDelegateImpl implements NotebookServiceDelegate {

		public function saveNote(note:NoteDto, responder:IResponder):void {
			var ro:RemoteObject = ServiceLocator.getInstance().retrieveRemoteObject("notebookService");
			var token:AsyncToken = ro.addNote(note);
			token.addResponder(responder);
		}
		public function retrieveNotes(userId:Number, responder:IResponder):void {
			if (null == responder) throw new Error("Illegal argument");
			var ro:RemoteObject = ServiceLocator.getInstance().retrieveRemoteObject("notebookService");
			var token:AsyncToken = ro.retrieveNotes(userId);
			token.addResponder(responder);
		}
		public function authenticate(username:String, password:String, responder:IResponder):void {
			throw new Error("NotebookServiceDelegateImpl.authenticate: Not implemented yet");
		}
	}
}